//
//  String+Extension.swift
//  ZHTQWeibo
//
//  Created by ZHTQ on 2018/9/18.
//  Copyright © 2018年 ZHTQ. All rights reserved.
//

import UIKit

extension String{
    ///缓存文件路径
    func cachesDict() -> String{
        //拿到路径
        let path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.cachesDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).first!
//        let name = (self as NSString).lastPathComponent
        let filePath = (path as NSString).appendingPathComponent(self)
        return filePath
    }
    ///doc文件路径
    func docDict() -> String{
        //拿到路径
        let path = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true).first!
//        let name = (self as NSString).lastPathComponent
        let filePath = (path as NSString).appendingPathComponent(self)
        return filePath
    }
    ///temp文件路径
    func tempDict() -> String{
        //拿到路径
        let path = NSTemporaryDirectory()
//        let name = (self as NSString).lastPathComponent
        let filePath = (path as NSString).appendingPathComponent(self)
        return filePath
    }
}
